/*
 * @Author: yaoling 1871883713@qq.com
 * @Date: 2022-10-20 18:11:21
 * @LastEditors: yaoling 1871883713@qq.com
 * @LastEditTime: 2022-12-06 14:56:09
 * @FilePath: \company-world\src\apis\jurisdiction\Notice.ts
 * @Description: 问题中心接口
 */
import Request from '@/apis/index'

// 问题中心问题列表数据
/**
 * @desc: 获取数据
 */
export function getProblemsList(params?: object) {
    return Request.get({
        url: '/admin/problem',
        method: 'GET',
        params: params
    })
}
/**
 * @desc: 删除
 */
export function deleteProblemsData(id?: number) {
    return Request.delete({
        url: "/admin/problem",
        method: "DELETE",
        params: { indexId: id },
    })
}
/**
 * @desc: 新增数据
 */
export function newProblemsData(data: Object) {
    return Request.post({
        url: "/admin/problem",
        method: "POST", 
        data: data,
    })
}
/**
 * @desc: 修改
 */
export function editProblemsData(data: Object) {
    return Request.put({
        url: "/admin/problem",
        method: "PUT", 
        data: data,
    })
}



// 问题中心评论
/**
 * @desc: 获取数据
 */
export function getCommentList() {
    return Request.get({
        url: '/admin/problem/comment',
        method: 'GET'
    })
}
/**
 * @desc: 删除
 */
export function deleteCommentData(id?: number) {
    return Request.delete({
        url: "/admin/problem/comment",
        method: "DELETE",
        params: { indexId: id },
    })
}
/**
 * @desc: 新增数据
 */
export function newCommentData(data: Object) {
    return Request.post({
        url: "/admin/problem/comment",
        method: "POST",
        data: data,
    })
}
/**
 * @desc: 修改
 */
export function editCommentData(data: Object) {
    return Request.put({
        url: "/admin/problem/comment",
        method: "PUT",
        data: data,
    })
}


// 问题中心操作日志
// 查询
export function getRecodeList(params:object) {
    return Request.post({
      url: '/api/mapi',
      data: {
        object_uuid: 'object638ca6650627a',
        view_uuid: 'view638ca6cae537d',
        __method_name__: 'dataList',
        transcode: 0,
        ...(params?params:'')
      }
    })
  }
  
  // 删除
  export function deleteRecodeData(id: Object) {
    return Request.post({
      url: '/api/mapi',
      data: {
        object_uuid: 'object638ca6650627a',
        view_uuid: 'view638ca6cae537d',
        __method_name__: 'deleteData',
        transcode: 0,
        data_id:id
      }
    })
  }
  
  // 创建
  export function newRecodeData(pageData: Object) {
    return Request.post({
      url: '/api/mapi',
      data: {
        object_uuid: 'object638ca6650627a',
        view_uuid: 'view638ca6cae537d',
        __method_name__: 'createData',
        transcode: 0,
        ...pageData
      }
    })
  }
  
  // 修改
  export function editRecodeData(upData: object,id:number) {
    return Request.post({
      url: '/api/mapi',
      data:{
        object_uuid: 'object638ca6650627a',
        view_uuid: 'view638ca6cae537d',
        __method_name__: 'updateData',
        data_id: id,
        ...upData
      }
    })
  }
  


// 问题中心标签
/**
 * @desc: 获取数据
 */
export function getTagList() {
    return Request.get({
        url: '/admin/problem/tag',
        method: 'GET'
    })
}
/**
 * @desc: 删除
 */
export function deleteTagData(id?: number) {
    return Request.delete({
        url: "/admin/problem/tag",
        method: "DELETE",
        params: { indexId: id },
    })
}
/**
 * @desc: 新增数据
 */
export function newTagData(data: Object) {
    return Request.post({
        url: "/admin/problem/tag",
        method: "POST",
        data: data,
    })
}
/**
 * @desc: 修改
 */
export function editTagData(data: Object) {
    return Request.put({
        url: "/admin/problem/tag",
        method: "PUT",
        data: data,
    })
}



// 问题中心问题点赞
/**
 * @desc: 获取数据
 */
export function getProblemsLike() {
    return Request.get({
        url: '/admin/problem/like',
        method: 'GET'
    })
}
/**
 * @desc: 删除
 */
export function deleteProblemsLike(id?: number) {
    return Request.delete({
        url: "/admin/problem/like",
        method: "DELETE",
        params: { indexId: id },
    })
}
/**
 * @desc: 新增数据
 */
export function newProblemsLike(data: Object) {
    return Request.post({
        url: "/admin/problem/like",
        method: "POST",
        data: data,
    })
}
/**
 * @desc: 修改
 */
export function editProblemsLike(data: Object) {
    return Request.put({
        url: "/admin/problem/like",
        method: "PUT",
        data: data,
    })
}






// 问题中心评论点赞
/**
 * @desc: 获取数据
 */
export function getLikeList() {
    return Request.get({
        url: '/admin/problem/comment/like',
        method: 'GET'
    })
}
/**
 * @desc: 删除
 */
export function deleteLikeData(id?: number) {
    return Request.delete({
        url: "/admin/problem/comment/like",
        method: "DELETE",
        params: { indexId: id },
    })
}
/**
 * @desc: 新增数据
 */
export function newLikeData(data: Object) {
    return Request.post({
        url: "/admin/problem/comment/like",
        method: "POST",
        data: data,
    })
}
/**
 * @desc: 修改
 */
export function editLikeData(data: Object) {
    return Request.put({
        url: "/admin/problem/comment/like",
        method: "PUT",
        data: data,
    })
}

